import axios from 'axios'
let _cancelFn = ''
export function getJoke (num) {
  // 关闭操作
  try {
    _cancelFn()
  } catch (err) {}
  return axios({
    url: 'https://autumnfish.cn/api/joke/list?num=' + num,
    cancelToken: new axios.CancelToken(cancelFunction => {
      // cancelFunction: 想取消当前api调用就执行该方法
      _cancelFn = cancelFunction
    })
  })
}
